package com.by.zhdoctor.huanxin.util;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;

/**
 * 保存环信基本信息的配置参数类
 * 仅供给环信相关的工具类使用，因为，不放入ioc，单独使用一个配置文件读取
 * Created by succy on 17-9-3.
 */
public class HuanXinInfo {
    private static final Logger log = LoggerFactory.getLogger(HuanXinInfo.class);
    public static String ORG_NAME;
    public static String APP_NAME;
    public static String GRANT_TYPE;
    public static String CLIENT_ID;
    public static String CLIENT_SECRET;

    static {
        InputStream in = HuanXinInfo.class.getClassLoader().getResourceAsStream("config/huanxin.properties");
        Properties prop = new Properties();
        try {
            prop.load(in);
        } catch (IOException e) {
            log.error("[异常] 加载环信配置文件出错; msg:{}", e.getMessage());
        }

        ORG_NAME = prop.getProperty("huanxin.org_name");
        APP_NAME = prop.getProperty("huanxin.app_name");
        GRANT_TYPE = prop.getProperty("huanxin.grant_type");
        CLIENT_ID = prop.getProperty("huanxin.client_id");
        CLIENT_SECRET = prop.getProperty("huanxin.client_secret");
    }

}
